# --coding:utf-8--

#玩家和庄家，初始都有10块钱，玩家猜对赢1块钱，猜错输一块钱，直到一方输光为止
#随机生成1~10的数，1~5为小，6~10为大
#玩家输入“d”代表大，输入“x”代表小

import random
mi = 10
pc = 10


def oneGame(dx):
    r = random.randrange(1,11)
    if r <= 5 and dx == "x":
        return True
    elif r >= 6 and dx == "d":
        return True
    else:
        return False

while mi > 0 and pc > 0 :
    dorx = input(f"压大压小？\n")
    if dorx != 'x' and dorx != 'd':
        print(f"输入错误，重来\n")
        continue
    if oneGame(dorx) :
        print(f"玩家赢,剩余：{mi}\n")
        mi = mi + 1
        pc = pc - 1
    else:
        print(f"庄家赢,剩余：{pc}\n")
        mi = mi - 1
        pc = pc + 1


